import { takeEvery, put, call } from 'redux-saga/effects'
import * as Constant from '../../constants'

const delay = n => new Promise((resolve, reject) => {
    setTimeout(() => {
        resolve(n)
    }, n)
})

// work saga
function* incrementAsync () {
    console.log(1);
    yield call(delay, 2e3);
    console.log(1.1);
}

// watch saga
export function* watchIncrementAsync() {
    console.log(0.1);
    yield takeEvery(Constant.GET_USER, incrementAsync)
}
